import { defineStore } from 'pinia';
import config from '@/common/config.js';
import Http from '@/common/request.js';

export const usePiniaStore = defineStore('xiangqing2', {
	unistorage: true,
	state: () => {
		return {
			bid: 'l8ZRRQvF563MPLMCXWvwlg==',
			vid: '100725769', //100725769
			City: '重庆市',
			openid: '',
			session_key: '',
			title: '',
			color: '#ff6501',
			service_tel: '',
			share_v_id: '',
			userInfo: '',
			logo: '',
			nameDefinition: '',
			withdrawal_rules: '', // 提现说明
			mode: 0, // 是否开起了分销
			share: '',
			App: '', // 小程序信息
			System: '',
			BarHeight: 40,
			totalHeight: 40,
			menuBut: '',
			menWidth: 80,

			position: { // 经纬度
				longitude: 0,
				latitude: 0,
			},
			articleInfo: '',
		}
	},
	getters: {
		inputPlace: (state) => `color:${state.color}`
	},
	actions: {
		Location() {
			wx.getFuzzyLocation({
				type: 'wgs84',
				success: (res) => {
					this.position = res;
				},
				fail: (err) => {
					console.log(err, 'err');
				}

			})
		},
		essayInfo() { // 红娘联系方式
			Http.post({
				url: '/zzjApp/articleInfo',
				data: { website_article_id: 32728 },
			}).then(res => {
				if (res.errcode != '00000') return;
				this.articleInfo = res.data;
			})
		},
	},


})